<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html><head>
	    <meta charset="utf-8">
    <title>111111111111111111111</title>

    <meta name="description" content="Dashboard">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!--Basic Styles-->
    <link href="http://localhost/shop//Application/Admin/public/style/bootstrap.css" rel="stylesheet">
    <link href="http://localhost/shop//Application/Admin/public/style/font-awesome.css" rel="stylesheet">
    <link href="http://localhost/shop//Application/Admin/public/style/weather-icons.css" rel="stylesheet">

    <!--Beyond styles-->
    <link id="beyond-link" href="http://localhost/shop//Application/Admin/public/style/beyond.css" rel="stylesheet" type="text/css">
    <link href="http://localhost/shop//Application/Admin/public/style/demo.css" rel="stylesheet">
    <link href="http://localhost/shop//Application/Admin/public/style/typicons.css" rel="stylesheet">
    <link href="http://localhost/shop//Application/Admin/public/style/animate.css" rel="stylesheet">
	
	<!--引入百度编辑器uidetor-->
	 <script src="http://localhost/shop//Application/Admin/public/ueditor/ueditor.config.js"></script>
	 <script src="http://localhost/shop//Application/Admin/public/ueditor/ueditor.all.min.js"></script>
	 <script src="http://localhost/shop//Application/Admin/public/ueditor/lang/zh-cn/zh-cn.js"></script>
    
</head>
<body>
	<!-- 头部 -->
	<div class="navbar">
    <div class="navbar-inner">
        <div class="navbar-container">
            <!-- Navbar Barnd -->
            <div class="navbar-header pull-left">
                <a href="#" class="navbar-brand">
                    <small>
                            <img src="http://localhost/shop//Application/Admin/public/images/logo.png" alt="">
                        </small>
                </a>
            </div>
            <!-- /Navbar Barnd -->
            <!-- Sidebar Collapse -->
            <div class="sidebar-collapse" id="sidebar-collapse">
                <i class="collapse-icon fa fa-bars"></i>
            </div>
            <!-- /Sidebar Collapse -->
            <!-- Account Area and Settings -->
            <div class="navbar-header pull-right">
                <div class="navbar-account">
                    <ul class="account-area">
                        <li>
                            <a class="login-area dropdown-toggle" data-toggle="dropdown">
                                <div class="avatar" title="View your public profile">
                                    <img src="http://localhost/shop//Application/Admin/public/images/adam-jansen.jpg">
                                </div>
                                <section>
                                    <h2><span class="profile"><span><?php echo (session('name')); ?></span></span></h2>
                                </section>
                            </a>
                            <!--Login Area Dropdown-->
                            <ul class="pull-right dropdown-menu dropdown-arrow dropdown-login-area">
                                <li class="username"><a>David Stevenson</a></li>
                                <li class="dropdown-footer">
                                    <a href="/shop/index.php/Admin/Goods/logout">
                                            退出登录
                                        </a>
                                </li>
                                <li class="dropdown-footer">
                                    <a href="/admin/user/changePwd.html">
                                            修改密码
                                        </a>
                                </li>
                            </ul>
                            <!--/Login Area Dropdown-->
                        </li>
                        <!-- /Account Area -->
                        <!--Note: notice that setting div must start right after account area list.
                            no space must be between these elements-->
                        <!-- Settings -->
                    </ul>
                </div>
            </div>
            <!-- /Account Area and Settings -->
        </div>
    </div>
</div>

	<!-- /头部 -->
	
	<div class="main-container container-fluid">
		<div class="page-container">
			            <!-- Page Sidebar -->
            <div class="page-sidebar" id="sidebar">
                <!-- Page Sidebar Header-->
                <div class="sidebar-header-wrapper">
                    <input class="searchinput" type="text">
                    <i class="searchicon fa fa-search"></i>
                    <div class="searchhelper">Search Reports, Charts, Emails or Notifications</div>
                </div>
                <!-- /Page Sidebar Header -->
                <!-- Sidebar Menu -->
                <ul class="nav sidebar-menu">
                    <!--Dashboard-->
                          <li>
								<a href="#" class="menu-dropdown">
											<i class="menu-icon fa fa-gear"></i>
											<span class="menu-text">管理员管理</span>
											<i class="menu-expand"></i>
								</a>
                                              <ul class="submenu">
                                                        <li>
																	<a href="/shop/index.php/Admin/Admin/lst">
																				<span class="menu-text">管理员列表</span>
																				<i class="menu-expand"></i>
																	</a>
                                                            </li>
												</ul>                            
								</li>    

                          <li>
								<a href="#" class="menu-dropdown">
											<i class="menu-icon fa-file-text-o"></i>
											<span class="menu-text">商品模块</span>
											<i class="menu-expand"></i>
								</a>
                                              <ul class="submenu">
                                                        <li>
																	<a href="/shop/index.php/Admin/Cate/lst">
																				<span class="menu-text">分类管理</span>
																				<i class="menu-expand"></i>
																	</a>
                                                            </li>
												</ul>  
												
												 <ul class="submenu">
                                                        <li>
																	<a href="/shop/index.php/Admin/Brand/lst">
																				<span class="menu-text">品牌管理</span>
																				<i class="menu-expand"></i>
																	</a>
                                                            </li>
												</ul>  
												<ul class="submenu">
                                                        <li>
																	<a href="/shop/index.php/Admin/Goods/lst">
																				<span class="menu-text">商品管理</span>
																				<i class="menu-expand"></i>
																	</a>
                                                            </li>
															
															<li>
																	<a href="/shop/index.php/Admin/Type/lst">
																				<span class="menu-text">商品类型</span>
																				<i class="menu-expand"></i>
																	</a>
                                                            </li>	
												</ul>  
								</li>
						 <li> 
								<a href="#" class="menu-dropdown">
											<i class="menu-icon  fa-file-text-o"></i>
											<span class="menu-text">导航设置</span>
											<i class="menu-expand"></i>
								</a>
									  <ul class="submenu">
												<li>
															<a href="/shop/index.php/Admin/Nav/lst">
																		<span class="menu-text">导航管理</span>
																		<i class="menu-expand"></i>
															</a>
													</li>
													
										</ul>                            
								</li>
								<li> 
								<a href="#" class="menu-dropdown">
											<i class="menu-icon  fa-file-text-o"></i>
											<span class="menu-text">文章模块</span>
											<i class="menu-expand"></i>
								</a>
									  <ul class="submenu">
												<li>
															<a href="/shop/index.php/Admin/category/lst">
																		<span class="menu-text">栏目管理</span>
																		<i class="menu-expand"></i>
															</a>
													</li>
													<li>
															<a href="/shop/index.php/Admin/article/lst">
																		<span class="menu-text">文章管理</span>
																		<i class="menu-expand"></i>
															</a>
													</li>
										</ul>                            
								</li>
								
						<li> 
								<a href="#" class="menu-dropdown">
											<i class="menu-icon fa fa-gear"></i>
											<span class="menu-text">广告模块</span>
											<i class="menu-expand"></i>
								</a>
                                              <ul class="submenu">
                                                        <li>
																<a href="/shop/index.php/Admin/Adpos/lst">
																		<span class="menu-text">广告位管理</span>
																		<i class="menu-expand"></i>
																</a>
                                                            </li>
															<li>
																	<a href="/shop/index.php/Admin/Ad/lst">
																			<span class="menu-text">广告管理</span>
																			<i class="menu-expand"></i>
																	</a>
                                                            </li>
												</ul>                            
								</li>
								<li> 
									<a href="#" class="menu-dropdown">
												<i class="menu-icon fa fa-gear"></i>
												<span class="menu-text">推荐位</span>
												<i class="menu-expand"></i>
									</a>
									<ul class="submenu">
											<li>
														<a href="/shop/index.php/Admin/Recpos/lst">
																	<span class="menu-text">推荐位列表</span>
																	<i class="menu-expand"></i>
														</a>
												</li>
									</ul>                            
								</li>

                          <li> 
								<a href="#" class="menu-dropdown">
											<i class="menu-icon fa fa-gear"></i>
											<span class="menu-text">会员模块</span>
											<i class="menu-expand"></i>
								</a>
                                              <ul class="submenu">
                                                      
															<li>
																	<a href="/shop/index.php/Admin/MemberLevel/lst">
																				<span class="menu-text">会员等级</span>
																				<i class="menu-expand"></i>
																	</a>
                                                            </li>
												</ul>                            
								</li>

                          <li>
								<a href="#" class="menu-dropdown">
											<i class="menu-icon fa fa-gear"></i>
											<span class="menu-text">系统管理</span>
											<i class="menu-expand"></i>
								</a>
										  <ul class="submenu">
													<li>
																<a href="/shop/index.php/Admin/Config/config">
																			<span class="menu-text">站点配置</span>
																			<i class="menu-expand"></i>
																</a>
														</li>
														<li>
																<a href="/shop/index.php/Admin/Config/lst">
																			<span class="menu-text">配置列表</span>
																			<i class="menu-expand"></i>
																</a>
														</li>
											</ul>                            
								</li>								
					</ul>
                <!-- /Sidebar Menu -->
            </div>
            <!-- /Page Sidebar -->
            <!-- Page Content -->
            <div class="page-content">
                <!-- Page Breadcrumb -->
                <div class="page-breadcrumbs">
                    <ul class="breadcrumb">
                                        <li>
                        <a href="#">系统</a>
                    </li>
                                        <li>
                        <a href="/shop/index.php/Admin/Goods/lst">商品列表</a>
                    </li>
                                        <li class="active">添加商品</li>
                                        </ul>
                </div>
                <!-- /Page Breadcrumb -->

                <!-- Page Body -->
                <div class="page-body">
                    
<div class="row">
    <div class="col-lg-12 col-sm-12 col-xs-12">
        <div class="widget">
            <div class="widget-header bordered-bottom bordered-blue">
                <span class="widget-caption">新增商品</span>
            </div>
            <div class="widget-body">
                <div id="horizontal-form">
                    <form class="form-horizontal" role="form" action="" method="post" enctype="multipart/form-data" >
                      <!---11111111111111111111111111111-->
					  <div class="tabbable">
								<ul class="nav nav-tabs tabs-flat" id="myTab11">
									<li class="active">
										<a data-toggle="tab" href="#home11">
											基本信息
										</a>
									</li>
									<li>
										<a data-toggle="tab" href="#profile11">
											商品描述
										</a>
									</li>
									<li>
										<a data-toggle="tab" href="#profile12">
											会员价格
										</a>
									</li>
									<li>
										<a data-toggle="tab" href="#profile13">
											商品属性
										</a>
									</li>
									<li>
										<a data-toggle="tab" href="#profile14">
											商品图片
										</a>
									</li>
								</ul>
								
									
									<div class="tab-content tabs-flat">
									<div id="home11" class="tab-pane active">
										

										<div class="form-group">
												<label for="username" class="col-sm-2 control-label no-padding-right">商品名称</label>
												<div class="col-sm-6">
													<input class="form-control" placeholder="" name="goods_name"   type="text"/>
												</div>
												<p class="help-block col-sm-4 red">* 必填</p>
										</div>
										
										<div class="form-group">
												<label for="username" class="col-sm-2 control-label no-padding-right">商品缩略图</label>
												<div class="col-sm-6">
													<input   placeholder="" name="original"   type="file"/>
												</div>		
										</div>
										
										<div class="form-group">
												<label for="username" class="col-sm-2 control-label no-padding-right">商品所属分类</label>
												<div class="col-sm-6">
													<select name="cate_id">
														<option>请选择</option>
														<?php if(is_array($cateres)): $i = 0; $__LIST__ = $cateres;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($vo["id"]); ?>"><?php echo str_repeat('----', $vo['level']); echo ($vo["cate_name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
													</select>
												</div>
												<p class="help-block col-sm-4 red">* 必填</p>
										</div>
										
										<div class="form-group">
												<label for="username" class="col-sm-2 control-label no-padding-right">商品所属品牌</label>
												<div class="col-sm-6">
													<select name="brand_id">
															<option>请选择</option>
															<?php if(is_array($brandres)): $i = 0; $__LIST__ = $brandres;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($vo["id"]); ?>"><?php echo ($vo["brand_name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
													</select>
												</div>
										</div>
										
										<div class="form-group">
												<label for="username" class="col-sm-2 control-label no-padding-right">市场价格</label>
												<div class="col-sm-6">
													<input class="form-control"  placeholder="" name="market_price"   type="text"/>
												</div>
												<p class="help-block col-sm-4 red">* 必填</p>
										</div>
										
										<div class="form-group">
												<label for="username" class="col-sm-2 control-label no-padding-right">本店价格</label>
												<div class="col-sm-6">
													<input class="form-control" placeholder="" name="shop_price"   type="text"/>
												</div>
												<p class="help-block col-sm-4 red">* 必填</p>
										</div>
										
										<div class="form-group">
												<label for="username" class="col-sm-2 control-label no-padding-right">商品重量</label>
												<div class="col-sm-6">
													<input class="form-control" placeholder="" name="goods_weight"   type="text" style="width:60%; float:left; "/>
													<select style="margin-left:20px" name="weight_unit">
														<option value="g">克</option>
														<option value="kg">千克</option>
													</select>
												</div>
												<p class="help-block col-sm-4 red">* 必填</p>
										</div>
										
										<div class="form-group">
												<label for="username" class="col-sm-2 control-label no-padding-right">是否上架</label>
												<div class="col-sm-6">
													<div class="checkbox">
                                                        <label>
                                                            <input type="checkbox" class="colored-success" checked="checked" name="onsale">
                                                            <span class="text">上架</span>
                                                        </label>
                                                    </div>
												</div>
												<p class="help-block col-sm-4 red">* 必填</p>
										</div>
										
										<div class="form-group">
												<label for="username" class="col-sm-2 control-label no-padding-right">设置推荐</label>
												<div class="col-sm-6">
													<div class="checkbox">
														<?php if(is_array($recpos)): $i = 0; $__LIST__ = $recpos;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><label style="margin-right:10px">
																<input type="checkbox" class="colored-success" name="recid[]" value="<?php echo ($vo["id"]); ?>">
																<span class="text"><?php echo ($vo["recname"]); ?></span>
															</label><?php endforeach; endif; else: echo "" ;endif; ?>
                                                    </div>
												</div>
												<p class="help-block col-sm-4 red">* 必填</p>
										</div>
										
									</div>
									
									<div id="profile11" class="tab-pane">
										<textarea id="goods_desc" name="goods_desc"></textarea>
									</div>
									<div id="profile12" class="tab-pane">
									<?php if(is_array($levres)): $i = 0; $__LIST__ = $levres;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><div class="form-group">
											<label for="username" class="col-sm-2 control-label no-padding-right" ><?php echo ($vo["level_name"]); ?></label>
											<div class="col-sm-6">
											<input class="form-control" name="mp[<?php echo ($vo["id"]); ?>]" type="text"/>
											</div>
											<p class="help-block col-sm-4 red">* 必填</p>
									</div><?php endforeach; endif; else: echo "" ;endif; ?>
									</div>
									
									<div id="profile13" class="tab-pane">
										<div class="form-group">
												<label for="username" class="col-sm-2 control-label no-padding-right">商品类型</label>
												<div class="col-sm-6">
													<select name="type_id">
														<?php if(is_array($typeres)): $i = 0; $__LIST__ = $typeres;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($vo["id"]); ?>"><?php echo ($vo["type_name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
													</select>
												</div>
												<p class="help-block col-sm-4 red">* 必填</p>
										</div>
										
										<div  id="attr"></div>
										
									</div>
									
									<div id="profile14" class="tab-pane">
									<div class="form-group">
												<label for="username" class="col-sm-2 control-label no-padding-right">
													<a href="javascript:;" id="addImg">[+]</a>.
												</label>
												<div class="col-sm-6">
													<input   name="goods_price[]"   type="file"/>
												</div>
												
										</div>
									</div>		
								</div>
							</div>
								<input type="submit" class="btn btn-darkorange btn-block" value="提交"  style="width:150px">
					   <!---11111111111111111111111111111-->
					   <!---11111111111111111111111111111-->
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

                </div>
                <!-- /Page Body -->
            </div>
            <!-- /Page Content -->
		</div>	
	</div>

	    <!--Basic Scripts-->
    <script src="http://localhost/shop//Application/Admin/public/style/jquery_002.js"></script>
    <script src="http://localhost/shop//Application/Admin/public/style/bootstrap.js"></script>
    <script src="http://localhost/shop//Application/Admin/public/style/jquery.js"></script>
    <!--Beyond Scripts-->
    <script src="http://localhost/shop//Application/Admin/public/style/beyond.js"></script>
	<script type="text/javascript">

    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    UE.getEditor('goods_desc',{initialFrameWidth:1000,initialFrameHeight:300,});
    
		var str='<div class="form-group"><label for="username" class="col-sm-2 control-label no-padding-right"><a  onclick="delImg(this);" href="javascript:;" id="addImg">[-]</a></label><div class="col-sm-6"><input   name="goods_pics[]"   type="file"/></div></div>';
	
		$("#addImg").click(function(){
			$("#profile14").append(str);
		});
		
		function delImg(o){
			$(o).parent().parent().remove();
		}
		
		function attrad(o){
		var div=$(o).parent().parent();
			if($(o).html() =='[+]'){
				var newdiv=div.clone();
				newdiv.find('a').html('[-]');
				div.after(newdiv);
			}else{
				div.remove();
			}
		}
		
		$("select[name=type_id]").change(function(){
			var  typeid=$(this).val();
			$.ajax({
				type:"GET",
				url:"/shop/index.php/Admin/Goods/ajaxgetattr/typeid/"+typeid,
				dataType:"json",
			//	success:function(data){
			//		var html=' ';
			//		$(data).each(function(k,v){	
			//			html+="<div class='form-group'><label for='username' class='col-sm-2 control-label no-padding-right'>"+v.attr_name+"</label><div class='col-sm-6'><input class='form-control' type='text' /></div></div>";
			//		});
			//		$("#attr").html(html);		
			//	}
				
				success : function(data){
					var html="";
					$(data).each(function(k,v){	
					//	html+="<div class='form-group'><label for='username' class='col-sm-2 control-label no-padding-right'>"+v.attr_name+"</label><div class='col-sm-6'><input class='form-control' type='text' /></div></div>";
					if(v.attr_type=='1'){
						var attrs=v.attr_values.split(",");
						html+="<div class='form-group'><label  class='col-sm-2 control-label no-padding-right'><a href='javascript:;' onclick='attrad(this);'>[+]</a>"+v.attr_name+"</label><div class='col-sm-6'>";
						html+="<select name='goods_attr["+v.id+"][]'><option>请选择</option>";
						for(var i=0; i<attrs.length; i++){
						html+="<option>"+attrs[i]+"</option>";
						}
						html+="</select><span>￥<input type='text' sytle='padding:4px 12px; width:70px; height:20px' value='0.00' name='goods_price[]'>元</span>";
						html+="</div></div>";
					}else{
						if(v.attr_values !=''){
							var attrs=v.attr_values.split(",");
							html+="<div class='form-group'><label  class='col-sm-2 control-label no-padding-right'>"+v.attr_name+"</label><div class='col-sm-6'>";
							html+="<select name='goods_attr["+v.id+"]'><option>请选择</option>";
							for(var i=0; i<attrs.length; i++){
							html+="<option>"+attrs[i]+"</option>";
							}
							html+="</select><input type='hidden' sytle='padding:4px 12px; width:70px; height:20px' value='0.00' name='goods_price[]'>";
							html+="</div></div>";
						}else{
							html+="<div class='form-group'><label for='username' class='col-sm-2 control-label no-padding-right'>"+v.attr_name+"</label><div class='col-sm-6'><input class='form-control' type='text'  name='goods_attr["+v.id+"]'/><input type='hidden' sytle='padding:4px 12px; width:70px; height:20px' value='0.00' name='goods_price[]'></div></div>";
						}
					}
					
					});
					$("#attr").html(html);		
				}	
				
				
				
			});
		});

</script>

</body></html>